Cevela about COBOL COBOL language - Home - Site Map - About Cevela - MX COBOL    <prev   next>
5.   Statements for file handling
For more see links to the main provider's on-line documentation.
For MX COBOL see Summary comment + FAQ and How to ..

Common structure

                                                                 60-1
file-control.
   select  [optional]  File-1
      assign  DatX-1
              Dev-1
      [organization]  org-spec-1*
      [access  access-spec-1*]
      [sharing-spec-1*]
      [file status  FileS-1]  .
   ...

[file section.] fd File-1 [file-spec-1*]. record-spec-1* 1 Rec-1 data-spec*. ... ...

working-storage section. 77 DatX-1 data-spec*.

procedure division. file-handling-statements* open,close,read,start,delete File-1 write,rewrite Rec-1


Det-1 org-spec* [line] sequential indexed {with record [and alternate] key phrases} relative {with relative key phrase}

acces-spec* sequential dynamic random

sharing-spec* {lock and sharing phrases}

file-spec* {block, recording and other phrases}

data-spec* see Data formats


MX limitations: org-spec*, sharing-spec* and file status have some restrictions see How to in MX Remarks: for details of provider's dialects and COBOL-02 - see links

open

                                                                 60-1
open
   work-mode-1*  file-spec-1*         ...
      input      File-1  [no rewind]
      output
      i-o                                                        68-1
      extend                                                     85-1
   ...
    

close

                                                                 60-1
close  File-1  ...

Remarks: there are some other phrases for sharing and device manipulation

read

                                                                 60-1
read  File-1  [into  Dat-2]
   end
      imperative-statements-3*
   [not end                                                      85-1
      imperative-statements-4*]
end-of-statement*
   end-read
   .

MX limitations: - the phrases not end, end-read are not implemented - see How to in MX

                                                                 85-2
read  File-1  next  [into  Dat-2]
              previous
   end
      imperative-statements-3*
   [not end
      imperative-statements-4*]
end-of-statement*
   end-read
   .

Remarks: there are some other phrases for sharing (not in MX) MX limitations: see format 85-1 above

                                                                 85-3
read  File-1  [into  Dat-2]  key  Dat-3
   invalid
      imperative-statements-3*
   [not invalid
      imperative-statements-4*]
end-of-statement*
   end-read
   .

Remarks: there are some other phrases for sharing (not in MX) MX limitations: see format 85-1 above

write

                                                                 60-1
write  Rec-1  [from  Dat-2]  [print-spec*]
   end-of-page
      imperative-statements-3*
   [not end-of-page                                              85-1
      imperative-statements-4*]
end-of-statement*
   end-write
   .

print-spec* after Dat-5 before Num-5 page
Remarks: there are some other phrases for sharing (not in MX) MX limitations: - the phrases not end-of-page, end-write are not implemented - see How to in MX

                                                                 85-2
write  Rec-1  [from  Dat-2]
   invalid
      imperative-statements-3*
   [not invalid
      imperative-statements-4*]
end-of-statement*
   end-write
   .

Remarks: there are some other phrases for sharing (not in MX) MX limitations: - the phrases invalid, not invalid, end-write are not implemented - see How to in MX

start

                                                                 85-2
start  File-1  key-spec-2*
   invalid
      imperative-statements-3*
   [not invalid
      imperative-statements-4*]
end-of-statement*
   end-start
   .

Remarks: there are some other phrases for key-spec-2* in the others dialects and COBOL-02 MX limitations: - the phrases not invalid, end-start are not implemented - see How to in MX

rewrite

                                                                 85-2
rewrite  Rec-1  [from  Dat-2]
   invalid
      imperative-statements-3*
   [not invalid
      imperative-statements-4*]
end-of-statement*
   end-rewrite
   .

Remarks: there are some other phrases for sharing (not in MX) MX limitations: - the phrases invalid, not invalid, end-rewrite are not implemented - see How to in MX

delete

                                                                 85-1
delete  File-1
   invalid
      imperative-statements-2*
   [not invalid
      imperative-statements-3*]
end-of-statement*
   end-delete
   .

Remarks: there are some other phrases for sharing (not in MX) MX limitations: see format read/85-1 above

unlock

                                                                 02-1
unlock  File-1

MX limitations: this statement is not implemented

commit

                                                                 MF-1
commit

MX limitations: this statement is not implemented

rollback

                                                                 MF-1
rollback

MX limitations: this statement is not implemented

COBOL language in brief - © Vlastimil Cevela 2006

Date 2006-06-03 - Text Builder 0.65 - Time 20:31:33